package com.shed.demo.dwr;

import java.io.Serializable;

import com.shed.base.exception.SHEDRuntimeException;
import com.shed.demo.domain.User;

public class BaseDwr implements Serializable {
	private static final long serialVersionUID = -8981137886322358300L;

	/**
	 * 获取session用户
	 * 
	 * @return 用户实例
	 */
	public User getCurrentUser() {
		Object ud = DwrAuthHelper.getUser();
		if (ud == null) {
			throw new SHEDRuntimeException("未取得当前用户信息，请登录后再试！");
		} else {
			return (User) ud;
		}
	}

	/**
	 * 获取登录ip
	 * 
	 * @return
	 */
	public String getIpAddress() {
		return DwrAuthHelper.getIpAddress();
	}
}
